//
//  MyButton.m
//  
//
//  Created by chris on 15/12/26.
//
//

#import "MyButton.h"

@implementation MyButton
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        _imageIV = [[UIImageView alloc]initWithFrame:CGRectMake(40, 10, frame.size.width-80, frame.size.height-50)];
        _imageIV.contentMode = UIViewContentModeScaleAspectFit;
        if (DEF_SCREEN_HEIGHT <= 568)
        {
            _imageIV.frame = CGRectMake(30, 5, frame.size.width-60, frame.size.height-20);
        }
        //_imageIV.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:_imageIV];
        
        _titleLa = [[UILabel alloc]initWithFrame:CGRectMake(30, frame.size.height-30, frame.size.width-60, 20)];
        if (DEF_SCREEN_HEIGHT <= 568)
        {
            _titleLa.frame = CGRectMake(0, frame.size.height-5, frame.size.width, 20);
        }
        _titleLa.textAlignment = NSTextAlignmentCenter;
        _titleLa.textColor = [UIColor lightGrayColor];
        _titleLa.font = font(11);
        [self addSubview:_titleLa];
    }
    return self;
}

- (void)setUiImage:(UIImage *)uiImage {
    _uiImage = uiImage;
    _imageIV.image = uiImage;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
